package com.qf.lanzhou.blog.api.service.impl;


import com.qf.lanzhou.blog.api.dao.CreationDao;
import com.qf.lanzhou.blog.api.dao.Impl.CreationDaoImpl;
import com.qf.lanzhou.blog.api.pojo.entity.Article;
import com.qf.lanzhou.blog.api.service.CreationService;

/**
 * @Author Nerly
 * @Date 2020/12/16 15:15
 * @JDK 1.8
 * @Version 1.0
 */
public class CreationServiceImpl implements CreationService {
    private CreationDao creationDao = new CreationDaoImpl();
    @Override
    public String checkExist(Article article) {
        Article getArticleByName = creationDao.getArticleByName(article);
        //判断文章名是否已存在
        //不存在，新增
        if (getArticleByName==null){
            //新增文章
            Article addArticle = creationDao.addArticle(article);
            return null;
        }
        //存在，抛出错误
        return "用户已存在";
    }
}
